﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Models;
using System.Data.SqlClient;

namespace BLL
{
    public class ComremarkManager
    {
        comremarkService service = new comremarkService();
        public bool add(Remark re)
        {
            return service.add(re);
        }
        public bool upd(string bh)
        {
            return service.upd(bh);
        }
        public List<Product> get(string id)
        {
            List<Product> rema = new List<Product>();
            SqlDataReader reader = service.get(id);
            while (reader.Read())
            {
                rema.Add(new Product(
                    reader.GetString(0),
                    reader.GetString(1),
                    reader.GetString(2),
                    reader.GetDecimal(3),
                    reader.GetInt32(4)
                    ));
            }
            DBhelper.Close();
            return rema;
        }
        //public List<Product> GetList2(int id)
        //{
        //    List<Product> coll = new List<Product>();
        //    SqlDataReader reader = service.getby(id);
        //    while (reader.Read())
        //    {
        //        coll.Add(new Product(
        //            reader.GetDecimal(0),
        //            reader.GetString(1),
        //            reader.GetString(2)
        //            ));
        //    }
        //    DBhelper.Close();
        //    return coll;
        //}
    }
}
